package com.ktjy.service.impl;

import com.ktjy.entity.SysRole;
import com.ktjy.mapper.SysRoleMapper;
import com.ktjy.service.SysRoleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @version v1.0
 * @Author JieGe
 * @Create 2024-12-19 - 10:41
 */
//创建SysRoleServiceImpl类的bean组件，并注册到spring容器中，即创建当前类的对象
@Service("sysRoleService")
public class SysRoleServiceImpl implements SysRoleService {

    private static final Logger LOGGER = LoggerFactory.getLogger(SysRoleServiceImpl.class);
    // 还需要注入SysRoleMapper接口实现类
    @Autowired
    private SysRoleMapper sysRoleMapper;

    // 查询所有的角色列表
    @Override
    public List<SysRole> findAll() {
        try {
            return sysRoleMapper.getAll();
        } catch (Exception e) {
            LOGGER.error("执行SysRoleServiceImpl.findAll()方法出现异常：", e);
            throw e;
        }
    }
}
